<?php


namespace app\controller;



use think\facade\Config;
use think\facade\Request;
use think\Response;

abstract class Base
{
    protected $page;
    protected $page_size;
    public function __construct(){
        $this->page=(int)Request::param('page',1);
        $this->page_size=(int)Request::param('page_size',Config::get('app.page_size'));
    }
    protected function createApi($data,$msg='',$code=200,$type='json'){
        $result=[
            'code'=>$code,
            'msg'=>$msg,
            'data'=>$data
        ];
        return  Response::create($result,$type);
    }
    public function __call($name,$argument){
        return $this->createApi([],'方法不存在',404);
    }
}